cmake_minimum_required(VERSION 3.15)
project(search_engine)

set(CMAKE_CXX_STANDARD 11)

set(SOURCES
        main.cpp
        sqlite3/sqlite3.c
        doc_manager.cpp doc_manager.h index_manager.cpp index_builder.h index_builder.cpp inverted_index.cpp search_manager.cpp doc_parser.cpp)

add_executable(search_engine ${SOURCES})

target_include_directories(search_engine
        PRIVATE
        ${PROJECT_SOURCE_DIR}/sqlite3
        ${PROJECT_SOURCE_DIR}/boost/include/boost-1_70
)


target_link_directories(search_engine
        PRIVATE
        ${PROJECT_SOURCE_DIR}/boost/lib)

target_link_libraries(search_engine
        PRIVATE
        boost_filesystem-mgw81-mt-sd-x64-1_70
        )

##############################################
# Unit Test
##############################################
project(test)

add_subdirectory(${PROJECT_SOURCE_DIR}/gtest)

set(TEST_SRC
        sqlite3/sqlite3.c
        doc_manager.cpp  test/doc_manager_test.cpp
        index_manager.cpp
        index_builder.cpp test/index_builder_test.cpp
        inverted_index.cpp test/inverted_index_test.cpp
        search_manager.cpp search_test.cpp
        tinyxml2/tinyxml2.cpp
        )

add_executable(test ${TEST_SRC})

target_include_directories(test
        PRIVATE
        ${PROJECT_SOURCE_DIR}
        ${PROJECT_SOURCE_DIR}/sqlite3
        ${PROJECT_SOURCE_DIR}/gtest/googletest/include
        ${PROJECT_SOURCE_DIR}/boost/include/boost-1_70
        )

target_link_directories(test
        PRIVATE
        ${PROJECT_SOURCE_DIR}/boost/lib)

target_link_libraries(test
        PRIVATE
        gtest_main
        boost_filesystem-mgw81-mt-sd-x64-1_70
        )
